@extends('backstage.layout.master')
@section('title', '产品详情')
@section('style')
    <link rel="stylesheet" type="text/css" href="backstage/assets/css/swiper.min.css">
    <style>
        .profile-info-row {
            height: 32px;
        }
        .profile-info-row img{
            width: 30px;
            height: 30px;
            border: 1px solid #000;
        }

        .type-change li a:hover {
            cursor: pointer;
        }

        .swiper-container {
            width: 100%;
        }
        .img-carousel{
            width:100%;
        }
    </style>
@stop
@section('content')
    <div class="breadcrumbs" id="breadcrumbs">
        <script type="text/javascript">
            try {
                ace.settings.check('breadcrumbs', 'fixed')
            } catch (e) {
            }
        </script>

        <ul class="breadcrumb">
            <li>
                <i class="icon-home home-icon"></i>
                <a href="backstage/home">主页</a>
            </li>

            <li class="active">
                <a href="backstage/products/list/1">产品列表</a>
            </li>
            <li>
                产品详情
            </li>
        </ul><!-- .breadcrumb -->
    </div>

    <div class="page-content">
        <div class="row">
            <div class="col-xs-12">
                <!-- PAGE CONTENT BEGINS -->
                <div class="page-header">
                    <h1>
                        产品详情
                    </h1>
                </div>
                <div class="row">
                    <div class="col-xs-12">
                        <!-- PAGE CONTENT BEGINS -->
                        <div id="user-profile-1" class="user-profile row">
                            <div class="col-xs-12 col-sm-5 center">
                                <div class="swiper-container">
                                    <div class="swiper-wrapper">
                                        @foreach($product->thumbnail as $carousel)
                                            <div class="swiper-slide">
                                                <img class="img-carousel" src="{{$carousel}}" alt="">
                                            </div>
                                        @endforeach
                                    </div>
                                    <div class="swiper-pagination"></div><!-- 分页器 -->
                                </div>
                                <div class="space-4"></div>

                                <div class="hr hr12 dotted"></div>

                                <div class="clearfix">
                                    <div class="grid2">
                                        <span class="bigger-175 blue">{{$product->sell_num}}</span>
                                        <br/>
                                        <a class="add" style="cursor: pointer;text-decoration:none;" title="已售数量">
                                            {{--<i class="icon-plus bigger-130" style="color:#0052d7;"></i>--}}
                                            <span style="font-size: 12px;cursor: pointer;color:#000000;">已售数量</span>
                                        </a>
                                    </div>

                                    <div class="grid2">
                                        <span class="bigger-175 blue">{{$product->collect_num}}</span>
                                        <br/>
                                        <a class="add" style="cursor: pointer;text-decoration:none;" title="收藏">
                                            {{--<i class="icon-plus bigger-130" style="color:#0052d7;"></i>--}}
                                            <span style="font-size: 12px;cursor: pointer;color:#000000;">收藏</span>
                                        </a>
                                    </div>
                                </div>

                                <div class="hr hr16 dotted"></div>
                            </div>


                            <div class="col-xs-12 col-sm-7">

                                <div class="profile-user-info profile-user-info-striped">
                                    <form class="form-horizontal" role="form" action=""
                                          method="post" enctype="multipart/form-data">
                                        <input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">

                                        <div class="profile-info-row">
                                            <div class="profile-info-name"></div>

                                            <div class="profile-info-value">
                                                <span class="editable"
                                                      id="product_name">{{$product->brand_name.$product->product_temp_name}}</span>
                                            </div>
                                        </div>

                                        <div class="profile-info-row">
                                            <div class="profile-info-name"> 原价</div>
                                            <div class="profile-info-value">
                                                <span class="editable"
                                                      id="original_price">￥{{$product->original_price}}</span>
                                            </div>
                                        </div>

                                        <div class="profile-info-row">
                                            <div class="profile-info-name"> 优惠价格</div>
                                            <div class="profile-info-value">
                                                <span class="editable"
                                                      id="preferential_price">￥{{$product->preferential_price}}</span>
                                            </div>
                                        </div>
                                        <div class="profile-info-row">
                                            <div class="profile-info-name"> 颜色</div>
                                            <div class="profile-info-value">
                                                <span class="editable"
                                                      id="colour">{{empty($product->colour) ? '' : $product->colour->colour_name}}</span>
                                                @if(!empty($product->colour))
                                                    <img src="{{$product->colour->colour_image}}">
                                                @endif
                                            </div>
                                        </div>
                                        <div class="profile-info-row">
                                            <div class="profile-info-name"> 款式</div>
                                            <div class="profile-info-value">
                                            <span class="editable" id="age">
                                                @foreach($product->sizes as $size)
                                                    {{$size['size_name'].'/'}}
                                                @endforeach
                                            </span>
                                            </div>
                                        </div>
                                        <div class="profile-info-row">
                                            <div class="profile-info-name"> 所属用户</div>
                                            <div class="profile-info-value">
                                                <span class="editable" id="user">
                                                    <img src="{{$product->avatar}}">&nbsp;&nbsp;{{$product->nick_name}}
                                                </span>
                                            </div>
                                        </div>
                                        <div class="profile-info-row">
                                            <div class="profile-info-name"> 溢价金额</div>
                                            <div class="profile-info-value">
                                                <span class="editable" id="overflow_price">
                                                    ￥{{$product->overflow_price}}
                                                </span>
                                            </div>
                                        </div>
                                        <div class="profile-info-row">
                                            <div class="profile-info-name">限购数量</div>
                                            <div class="profile-info-value">
                                                <span class="editable" id="stock">
                                                    @if($product->is_infinite_stock == 1)
                                                        不限
                                                        @else
                                                        {{$product->stock}}
                                                    @endif
                                                </span>
                                            </div>
                                        </div>
                                        <div class="profile-info-row">
                                            <div class="profile-info-name">已售数量</div>
                                            <div class="profile-info-value">
                                                <span class="editable">
                                                   {{$product->sell_num}}
                                                </span>
                                            </div>
                                        </div>
                                        <div class="profile-info-row">
                                            <div class="profile-info-name"> 下架时间</div>
                                            <div class="profile-info-value">
                                                <span class="editable" id="user">
                                                    @if($product->is_infinite_time == 1)
                                                        不限
                                                        @else
                                                        {{date('Y-m-d H:i:s',$product->off_shelves_time)}}
                                                    @endif
                                                </span>
                                            </div>
                                        </div>
                                        <div class="profile-info-row">
                                            <div class="profile-info-name"> 赠品</div>
                                            <div class="profile-info-value">
                                                <span class="editable" id="gift">
                                                    @foreach($product->gift as $item)
                                                        {{$item->name}}&nbsp;x{{$item->num}}
                                                    @endforeach
                                                </span>
                                            </div>
                                        </div>
                                        {{--<div class="profile-info-row" style="height: 100px;">--}}
                                            {{--<div class="profile-info-name"> 备注</div>--}}

                                            {{--<div class="profile-info-value">--}}
                                             {{--<textarea class="editable form-edit" name="remarks" readonly="true"--}}
                                                       {{--id="remarks" style="width: 97%;" rows="4"--}}
                                                       {{--placeholder="备注">{{$product->remarks}}</textarea>--}}
                                            {{--</div>--}}
                                        {{--</div>--}}
                                        {{--<div class="btn-groud " style="margin-top:10px;padding-right: 2%;">--}}
                                            {{--<input type="submit" class="btn btn-success done"--}}
                                                   {{--style="float: right;display: none;margin-left: 10px;" value="完成">--}}
                                            {{--<input type="reset" class="btn reset" style="float: right;display: none;"--}}
                                                   {{--value="重置">--}}
                                            {{--<input type="button" class="btn btn-primary update" style="float: right"--}}
                                                   {{--value="修改">--}}
                                        {{--</div>--}}
                                        <!-- PAGE CONTENT ENDS -->
                                    </form>
                                </div>
                            </div>
                        </div>
                        <div class="page-header">
                            <h1>
                                产品明细列表
                            </h1>
                        </div>
                        <div class="table-responsive">
                            <table id="sample-table-1" class="table table-striped table-bordered table-hover">
                                <thead>
                                <tr>
                                    <th>资源ID</th>
                                    <th>资源名称</th>
                                    <th>资源图</th>
                                    <th>资源优惠价</th>
                                    <th>资源原价</th>
                                    <th>资源类型</th>
                                    <th>资源数量</th>
                                </tr>
                                </thead>

                                <tbody>
                                @foreach ($product->lists as $list)
                                    <tr>
                                        <td>{{$list['resource_id']}}</td>
                                        <td>{{$list['title']}}</td>
                                        <td>
                                            <img src="{{$list['thumbnail']}}" style="width: 120px;"/>
                                        </td>
                                        <td>￥{{$list['preferential_price']}}</td>
                                        <td>￥{{$list['original_price']}}</td>
                                        <td>
                                            @if($list['type'] == 1)
                                                模板
                                                @elseif($list['type'] == 2)
                                                自定义素材
                                                @elseif($list['type'] == 3)
                                                平台素材
                                                @else
                                                字体
                                            @endif
                                        </td>
                                        <td>
                                            {{$list['quantity']}}
                                        </td>
                                    </tr>
                                @endforeach
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <!-- PAGE CONTENT ENDS -->
                </div><!-- /.col -->
            </div>
        </div><!-- /.row -->
    </div><!-- /.page-content -->
@stop
@section('script')
    <script type="text/javascript" src="backstage/assets/js/swiper.min.js"></script>
    <script type="text/javascript">
        $(function () {
            var mySwiper = new Swiper('.swiper-container', {
                width: $(".center").width(),
                pagination: '.swiper-pagination',
                loop: true
            })
        });
    </script>
@stop